//
//  MessageCell.m
//  AILock
//
//  Created by 谭亚明 on 2020/7/22.
//  Copyright © 2020 tym. All rights reserved.
//

#import "MessageCell.h"

@interface MessageCell ()

@property(nonatomic,weak) IBOutlet UIImageView *headImage;
@property(nonatomic,weak) IBOutlet UILabel *titleLab;
@property(nonatomic,weak) IBOutlet UILabel *contLab;
@property(nonatomic,weak) IBOutlet UILabel *timeLab;
@property(nonatomic,weak) IBOutlet UIView *redView;
@end

@implementation MessageCell

-(void)awakeFromNib{
    [super awakeFromNib];
    self.headImage.layer.masksToBounds = YES;
    self.headImage.layer.cornerRadius = 5;
    
    self.contentView.backgroundColor = [UIColor whiteColor];
    
    self.redView.backgroundColor = rgba(253, 93, 110);
    self.redView.layer.masksToBounds = YES;
    self.redView.layer.cornerRadius = 2.5;
}

-(void)setMessageModel:(UserMessageModel *)messageModel{
    
    self.titleLab.text = [NSString stringWithFormat:@"%@%@",messageModel.familyName,[messageModel getTypeStr]];
    self.contLab.text = messageModel.newsContent;
    self.headImage.image = [UIImage imageNamed:[NSString stringWithFormat:@"icon_mes%ld",messageModel.type]];
    self.timeLab.text = [messageModel.createTime substringWithRange:NSMakeRange(11, 5)];
    
    if (messageModel.readed) {
        self.redView.hidden = YES;
    }else{
        self.redView.hidden = NO;
    }
}

+ (CGFloat)cellForHeight{
    return 67.5;
}

+ (NSString *)identifier{
    return @"MessageCell";
}

@end
